<?php
namespace WechatSDK\Components;

use WechatSDK\Lib\Tools;
require_once ('Common.php');

/**
 * 微信网页授权组件
 * @author guibinyu
 * @date 2017-06-15 04:14:50
 */
class User extends Common
{

   
    const SUBSCIRBE_USER_URL = '/user/info?';
     const SUBSCIRBE_USER_LIST_URL = '/user/get?';
	function __construct($appid,$secret,$token)
	{
            parent::__construct($appid,$secret,$token);
	}

	function __destruct()
	{
	}
    
    public function getUserInfo($openid) {
         $this->throwAccessTokenError();
        $lang = 'zh_CN';
        $result = Tools::httpGet(self::API_URL_PREFIX . self::SUBSCIRBE_USER_URL . "access_token={$this->access_token}&openid={$openid}&lang={$lang}");
        
         $result = $this->parsing($result);
        return $result;
    }
    public function getUserList($next_openid='') {
         $this->throwAccessTokenError();
        $lang = 'zh_CN';
        $result = Tools::httpGet(self::API_URL_PREFIX . self::SUBSCIRBE_USER_LIST_URL . "access_token={$this->access_token}&next_openid={$next_openid}");
        
         $result = $this->parsing($result);
        return $result;
    }

}
?>